package com.cow.framework.core.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import com.cow.framework.core.cache.RedisUtil;
import com.cow.framework.core.config.dict.DictUtil;
import com.cow.framework.core.config.parameter.ParameterUtil;

/**
 *	控制类基类
 *
 *  @author yangsj
 */
public class BaseComponent{
	protected final Logger logger = LoggerFactory.getLogger(this.getClass());  
	@Autowired
	protected RedisUtil redisUtil;
	@Value("${spring.profiles.active}")
	protected String active;
	@Value("${app.fileHome}")
	protected String fileHome;
	@Value("${app.tempFileHome}")
	protected String tempFileHome;
	@Value("${spring.application.name}")
	protected String appName;
	@Autowired
	protected ParameterUtil parameterUtil;
	@Autowired
	protected DictUtil dictUtil;

	/**读取缓存*/
	protected Object getCache(String key){
		return redisUtil.get(key);
	}
	
	/**写入缓存*/
	protected void setCache(String key, Object value,Long expireTime){
		redisUtil.set(key,value,expireTime);
	}
	
}
